<?php

 function common_render_donate(){
	?>
	<img class="btn btn-warning user_post_register img-responsive" style="padding: 0px; background: none; border: none;" src="<?php echo HOME ?>public/images/donate.png" />
    <!-- <div style="background-color:#27ae60; border-radius:4px; color:#fff; padding:5px">
    	Tham gia chia sẻ anime yêu thích của bạn đến với cộng đồng ANIME24H.VN , Hiện tại Anime24h đang thiếu uploader trầm trọng  vì thế nếu bạn có khả năng và muốn giúp đỡ chúng tôi một tay thì đăng ký ngay nhé.<Br/><Br/>
        <div style="text-align:center"><a class="btn btn-warning user_post_register">ĐĂNG KÝ UPLOAD ANIME <i class="fa fa-share"></i></a></div>
    </div> -->
    <Br/><br />
    <?php
	 }
	function render_page_adv(){
		$cache=new cache;
		$res=$cache->load("page_adv",'',1);	
		if(!$res){
			$md=new Model;
			$md->query("select * from blog_video where pick=1 order by id desc limit 0,10");
			if($md->num_rows()>0){
			$res['video']=$md->fetchAll();
			}
			
			
	    $sql ="SELECT id,name,alias,upload_user,upload_time,post,view,subcategory from blog_post where pick_home=1 and status=1 order by id desc";
		$sql2="SELECT id from blog_post where  pick_home=1 and status=1";

		  $pager = new Pagination($sql, 10, 5,$og_url,0,"blog_get_user");
		  $pager->setDebug(false);
		  $res['blog']=$pager->paginate($cache,$sql2);
			
	    $cache->save("page_adv",$res,500,'',1);
		}
	
    //	<!-- Start blog and video section -->
                           $str.=' <div class="row">';
                            	$str.='<div class="col-md-6">';
                                //	<!-- Start Video -->
                                    $str.='<div class="right-block" id="video-block">';
					$str.='<span class="right-block-title">';
						$str.='Hot Video <a href="http://truyencuatui.info/video" class="right-view-all">Xem hết &raquo;</a>';
					$str.='</span>';
					$str.='<div class="right-block-content">';
                    
						$j=1;
						 foreach($res['video'] as $val){
						 $vl=video_get_infor($val['url']);
						if($j%2==0){	
						$str.='<div class="each-right-item right-odd">';
						}else{
						$str.='<div class="each-right-item right-even">';
						}
						$str.='<a class="right-item-img-a" href="'.video_url_item($val['id'],$val['alias']).'" title=""><img src="http://i.ytimg.com/vi/'.$vl['v'].'/mqdefault.jpg" alt="" /></a>';
							
								$str.='<a href="'.video_url_item($val['id'],$val['alias']).'" class="right-block-item-title">'.$val['name'].'</a><br />';
								$str.='<span class="right-item-metadata right-item-author"><i class="fa fa-user"></i> '.show_username($val['user']['username'],$val['user']['name']).'</span>';
								$str.='<span class="right-item-metadata right-item-time"><i class="fa fa-clock-o"></i> '.time_ago($val['upload_time']).'</span>';
							
						$str.='</div>';
						$j++;
                       }
					     $str.=' </div>';
						   $str.=' </div>';
                            //   <!-- eND Video -->
                               $str.=' </div>';
							   
							   if($res['blog']){
                               $str.=' <div class="col-md-6">';
                                //	<!-- Start blog -->
                                    	
				$str.='<div class="right-block" id="blog-block">';
					$str.='<span class="right-block-title">';
						$str.='Hot Blog <a href="http://truyencuatui.info/blog" class="right-view-all">Xem hết &raquo;</a>';
					$str.='</span>';
					$str.='<div class="right-block-content">';
					$j=1;
					foreach($res['blog'] as $val){
						if($j%2==0){
							$str.='<div class="each-right-item right-odd">';
						}else{
								$str.='<div class="each-right-item right-even">';
						}
						$j++;
							$str.='<a class="right-item-img-a" href="'.$val['url'].'" title=""><img src="'.user_avatar($val['user']['avatar']).'" alt="" /></a>';
								$str.='<a href="'.$val['url'].'" class="right-block-item-title">'.$val['name'].'</a><br />';
								$str.='<span class="right-item-metadata right-item-author"><i class="fa fa-user"></i>'.show_username($val['user']['username'],$val['user']['name']).'</span>';
								$str.='<span class="right-item-metadata right-item-time"><i class="fa fa-clock-o"></i>'.time_ago($val['upload_time']).'</span>';
							$str.='</div>';
					}
									
						
					$str.='</div>'; 
				$str.='</div>';
                                 //   <!-- End blog -->
                               $str.=' </div>';
			} //End if($res['blog'])
                            
                          $str.=' </div>';
						  $str.='<div class="clearfix"></div>';
        					//<!-- End blog and video section -->
			return $str;				
   
	}
	
	
	
	function render_page_adv_2(){
		$cache=new cache;
		$res=$cache->load("page_adv",'',1);	
		if(!$res){
			$md=new Model;
			$md->query("select * from blog_video where pick=1 order by id desc limit 0,10");
			if($md->num_rows()>0){
			$res['video']=$md->fetchAll();
			}
			
			
	    $sql ="SELECT id,name,alias,upload_user,upload_time,post,view,subcategory from blog_post where pick_home=1 and status=1 order by id desc";
		$sql2="SELECT id from blog_post where  pick_home=1 and status=1";

		  $pager = new Pagination($sql, 10, 5,$og_url,0,"blog_get_user");
		  $pager->setDebug(false);
		  $res['blog']=$pager->paginate($cache,$sql2);
			
	    $cache->save("page_adv",$res,500,'',1);
		}
	
    //	<!-- Start blog and video section -->
                           $str.=' <div class="row">';
                            	$str.='<div class="col-md-6">';
                                //	<!-- Start Video -->
                                    $str.='<div class="right-block" id="video-block">';
					$str.='<span class="right-block-title">';
						$str.='Hot Video <a href="http://truyencuatui.info/video" class="right-view-all" target="_blank" rel="nofollow">Xem hết &raquo;</a>';
					$str.='</span>';
					$str.='<div class="right-block-content">';
                    
						$j=1;
						 foreach($res['video'] as $val){
						 $vl=video_get_infor($val['url']);
						if($j%2==0){	
						$str.='<div class="each-right-item right-odd">';
						}else{
						$str.='<div class="each-right-item right-even">';
						}
						$str.='<a class="right-item-img-a" href="'.video_url_item($val['id'],$val['alias']).'" title="" target="_blank" rel="nofollow"><img src="http://i.ytimg.com/vi/'.$vl['v'].'/mqdefault.jpg" alt="" /></a>';
							
								$str.='<a href="'.video_url_item($val['id'],$val['alias']).'" class="right-block-item-title" target="_blank" rel="nofollow">'.$val['name'].'</a><br />';
							//	$str.='<span class="right-item-metadata right-item-author"><i class="fa fa-user"></i> '.show_username($val['user']['username'],$val['user']['name']).'</span>';
								$str.='<span class="right-item-metadata right-item-time"><i class="fa fa-clock-o"></i> '.time_ago($val['upload_time']).'</span>';
							
						$str.='</div>';
						$j++;
                       }
					     $str.=' </div>';
						   $str.=' </div>';
                            //   <!-- eND Video -->
                               $str.=' </div>';
							   
							   if($res['blog']){
                               $str.=' <div class="col-md-6">';
                                //	<!-- Start blog -->
                                    	
				$str.='<div class="right-block" id="blog-block">';
					$str.='<span class="right-block-title">';
						$str.='Hot Blog <a href="http://truyencuatui.info/blog" class="right-view-all" target="_blank" rel="nofollow">Xem hết &raquo;</a>';
					$str.='</span>';
					$str.='<div class="right-block-content">';
					$j=1;
					foreach($res['blog'] as $val){
						if($j%2==0){
							$str.='<div class="each-right-item right-odd">';
						}else{
								$str.='<div class="each-right-item right-even">';
						}
						$j++;
							$str.='<a class="right-item-img-a" href="'.$val['url'].'" title="" target="_blank" rel="nofollow"><img src="'.user_avatar($val['user']['avatar']).'" alt="" /></a>';
								$str.='<a href="'.$val['url'].'" class="right-block-item-title" target="_blank" rel="nofollow">'.$val['name'].'</a><br />';
								$str.='<span class="right-item-metadata right-item-author"><i class="fa fa-user"></i>'.show_username($val['user']['username'],$val['user']['name']).'</span>';
								$str.='<span class="right-item-metadata right-item-time"><i class="fa fa-clock-o"></i>'.time_ago($val['upload_time']).'</span>';
							$str.='</div>';
					}
									
						
					$str.='</div>'; 
				$str.='</div>';
                                 //   <!-- End blog -->
                               $str.=' </div>';
			} //End if($res['blog'])
                            
                          $str.=' </div>';
						  $str.='<div class="clearfix"></div>';
        					//<!-- End blog and video section -->
			return $str;				
   
	}
function common_render_desktop_nav_right(){?>	
	  <ul class="nav navbar-nav navbar-right">
      				  <li ><a href="<?php echo HOME;?>chat"><i class="fa fa-wechat"></i> Chat Chit</a></li>
    			    <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><span
                    class="fa fa-upload"></span> Upload <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                       <li role="presentation" class="dropdown-header">Bạn Phải Đăng Nhập Để Upload</li>
                        <li class="divider"></li>
                    <li role="presentation" class="dropdown-header">Manga</li>
                        <li><a href="<?php echo HOME.'index.php?module=manage&act=manga&opt=common&type=manga';?>"><span class="fa fa-book"></span> Truyện</a></li>
                        <li><a href="<?php echo HOME.'index.php?module=manage&act=manga&opt=upload';?>"><i class="fa fa-th"></i> Chapter</a></li>
                        <li class="divider"></li>
                    <li role="presentation" class="dropdown-header">Truyện Chữ</li>
                      <li><a href="<?php echo HOME.'index.php?module=manage&act=truyen&opt=common&type=truyen';?>"><span  class="fa fa-book"></span> Truyện</a></li>
                     <li><a href="<?php echo HOME.'index.php?module=manage&act=truyen&opt=upload';?>"><i class="fa fa-th"></i> Chương</a></li>
                     <li class="divider"></li>
                  <li role="presentation" class="dropdown-header">Blog</li>
                      <li><a href="<?php echo HOME.'index.php?module=manage&act=blog&opt=post';?>"><span class="glyphicon glyphicon-list-alt"></span> Post</a></li>
                     <li><a href="<?php echo HOME.'index.php?module=manage&act=blog&opt=video';?>"><i class="fa fa-youtube-play"></i> Video</a></li>
                       
                    </ul>
                </li>
                <?php common_static_admin(); ?>
                <?php if(!isset($_SESSION['user'])){ ?>
               
                <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><span
                    class="glyphicon glyphicon-user"></span>Tài Khoản <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="<?php echo REGISTER;?>"><span class="glyphicon glyphicon-user"></span> Đăng Ký</a></li>
                        <li><a href="<?php echo LOGIN;?>"><span class="glyphicon glyphicon-cog"></span> Đăng Nhập</a></li>
                       
                    </ul>
                </li>
                <?php }else{?>
               	<li class="dropdown"><a href="#" class="dropdown-toggle"	data-toggle="dropdown"><i class="fa fa-user"></i> <?php echo show_username($_SESSION['user']['username'],$_SESSION['user']['name']);?>
							<b class="caret"></b> </a>
						<ul class="dropdown-menu">
							<li role="presentation" class="dropdown-header">Tài Khoản</li>
                               <li><a href="<?php echo user_url_home($_SESSION['user']['username']);?>">Trang Cá Nhân</a></li>
							<li><a href="<?php echo USER_INFO;?>">Thông Tin</a></li>
							<li><a href="<?php echo USER_CHANGEPASSWORD; ?>">Thay đổi mật khẩu</a></li>
							<li><a	href="<?php echo HOME ?>user/history/manga">Theo Dõi Manga</a></li>
					<li role="presentation" class="divider"></li>
							<li role="presentation" class="dropdown-header">Quản Lý Nội Dung</li>			
                          	<li><a	href="<?php echo HOME ?>index.php?module=manage&act=manga&opt=common&type=manga">Manga</a>	</li>
							<li><a	href="<?php echo HOME ?>index.php?module=manage&act=blog&opt=post">Blog</a>	</li>
                            <li><a	href="<?php echo HOME ?>index.php?module=manage&act=blog&opt=video">Video</a>	</li>
							<li role="presentation" class="divider"></li>
							<li><a href="<?php echo LOGOUT ?>"><span class="glyphicon glyphicon-log-out"></span> Thoát</a></li>
						</ul>
					</li>
                <?php }?>
            </ul>
 <?php }
 
 function common_render_disqus(){
	 $content=file_get_contents('http://truyencuatui.disqus.com/combination_widget.js?num_items=25&hide_mods=0&color=green&default_tab=recent&excerpt_length=40');
	 $content=str_replace('Recent Comments','Mới Thảo Luận',$content);
	 $content=str_replace('Recent','Mới',$content);
	 $content=str_replace('People','Thành viên',$content);
	 $content=str_replace('Popular','Phổ biến',$content);
	 echo '<script>';
	 echo $content;
	 echo "</script>";
	echo "<style>";
	echo '#dsq-combo-widget.green #dsq-combo-content .dsq-combo-box {background: #fff;}
    			#dsq-combo-widget #dsq-combo-tabs{ float: none; background: #fafafa;  overflow: hidden;  padding: 5px 4px;}
    			 #dsq-combo-widget.green #dsq-combo-tabs li{background: none; padding: 3px 6px;}
    			#dsq-combo-widget.green #dsq-combo-tabs li.dsq-active{background: url(http://truyencuatui.info/public/images/green-bg.jpg)}
    			#dsq-combo-widget.green #dsq-combo-tabs li.dsq-active a{color: #fff}
    			#dsq-combo-widget #dsq-combo-tabs li a{font-size: 12px; color: #666;}';
	echo "</style>";
 }